package com.cn.api;



import com.cn.dot.AliPayDTO;
import com.cn.dto.FindDto;
import io.swagger.annotations.ApiOperation;
import com.cn.dto.OrderDTO;
import com.cn.dto.Paging;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Primary
@FeignClient(value = "order-client", path = "/api/order")
public interface OrderCoreService {

    //查找所有
    @GetMapping("/findAll")
    List<OrderDTO> findAll(@RequestBody FindDto findDto);
    //订单号查找订单
    @GetMapping("/findByOrderNumber")
    OrderDTO findByOrderNumber(@RequestParam("orderNumber") String orderNumber);
    //生成订单
    @PostMapping("/generateOrder")
    int generateOrder(@RequestBody OrderDTO orderDTO);
    //删除订单
    @PostMapping("/delete")
    int delete(@RequestParam("orderNumber") String orderNumber);
    //修改订单状态
    @PostMapping("/updateStatus")
    int updateStatus(@RequestParam("orderNumber") String orderNumber);
    //修改订单状态
    @PostMapping("/updateStatusCancel")
    int updateStatusCancel(@RequestParam("orderNumber") String orderNumber);
    @PostMapping("/addRelation")
    int addRelation(@RequestParam("orderNumber") String orderNumber,List<Integer> visitorId);

    @PostMapping("competitionForOrders")
    OrderDTO competitionForOrders(@RequestParam("id") int adminId, @RequestParam("orderNumber") String orderNumber);
    @PostMapping("findByAdminId")
    int success(@RequestParam("id") int adminId);
    @PostMapping("fail")
    int fail(@RequestParam("orderNumber") String orderNumber);

//    @ApiOperation(value = "支付接口")
//    @GetMapping("/pay")
//    String pay(@RequestBody AliPayDTO aliPayDTO);
//
    @ApiOperation(value = "回调接口")
    @PostMapping("/notify")
    String payNotify(HttpServletRequest request) throws Exception;
//
    @ApiOperation(value = "退款接口")
    @RequestMapping(value = "/payReFund")
    String payReFund(String trade_no, String refund_amount);

    @ApiOperation(value = "生成二维码")
    @PostMapping("/generateCode")
    String generateCode(AliPayDTO aliPayDTO);
}

